//
//  BGCommonConst.m
//  BluetoothCameraHead
//
//  Created by KBTC－iMac on 16/11/21.
//  Copyright © 2016年 BG. All rights reserved.
//


u8 crc_slow(u8 const *message, u8 nBytes) {
    u8 remainder = 0, i, byte;
    for(byte = 0; byte < nBytes; ++byte) {
        remainder ^= (message[byte] << (WIDTH - 8));
        for(i = 8; i > 0; --i){
            if(remainder & TOPBIT){
                remainder = (remainder << 1) ^ POLYNOMIAL; }
            else {
                remainder = (remainder << 1);
            }
        } }
    return (remainder);
}
